package builder

type Builder interface {
	Part1()
	Part2()
	Part3()
}

type Director struct {
	builder Builder
}

func NewDirector(b Builder) *Director {
	return &Director{builder: b}
}

func (d *Director) MakeData() {
	d.builder.Part1()
	d.builder.Part2()
	d.builder.Part3()
}

type StringBuilder struct {
	result string
}

func (sb *StringBuilder) Part1() {
	sb.result += "1"
}

func (sb *StringBuilder) Part2() {
	sb.result += "2"
}

func (sb *StringBuilder) Part3() {
	sb.result += "3"
}

func (sb *StringBuilder) GetResult() string {
	return sb.result
}

type IntBuilder struct {
	result int64
}

func (ib *IntBuilder) Part1() {
	ib.result += 1
}

func (ib *IntBuilder) Part2() {
	ib.result += 2
}

func (ib *IntBuilder) Part3() {
	ib.result += 3
}

func (ib *IntBuilder) GetResult() int64 {
	return ib.result
}
